const { readFile, baseUrl, request } = require('../base.js');
const Cookie = readFile('Cookie.txt');    //用户Cookie

/* 查询导出Excel

* type: 类型,
  value: 数字拼接字符
*/
module.exports = async function historyExcel(lotid = '3d', limit = 300, year = '') {
    try {
      const url = `${baseUrl}/api/kaijiang/getlist?lotid=${lotid}&limit=${limit}&year=${year}`;
      let res = await request({
        url,
        headers: {
            "accept": "*/*",
            "content-type": "application/x-www-form-urlencoded",
            "cookie": Cookie,
            "Referer": `${baseUrl}/kj/list-${lotid}.html`,
        },
        // body: `&lotid=${lotid}&limit=${limit}&year=${year}`,
        method: "POST"
      });
      return res;
    } catch (error) {
      return error;
    }
  }